import { useContext } from 'react'
import { DocumentStateContext } from './DocumentStateProvider'

export const useDocumentState = () => {
  const context = useContext(DocumentStateContext)

  if (!context) {
    throw new Error('useDocumentState 必须在 DocumentStateProvider 内使用')
  }

  return context
}
